<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/plugins/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/css/global.css" media="all">
    <link rel="stylesheet" href="/plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/css/table.css"/>
    <title>简介管理</title>
    <style type="text/css">
        .searcheBottom{margin-bottom: 10px;}
    </style>
</head>
<body>
<div class="admin-main">
    <blockquote class="layui-elem-quote">
        <div class="demoTable">
            <div class="layui-inline searcheBottom">
                <a data-opt="add" href="/manage/intro/addIntro" class="layui-btn" id="addReport"><i class="layui-icon">&#xe608;</i>添加简介</a>
            </div>
        </div>
    </blockquote>
    <span style="font-size: 16px;"><b>简介列表</b></span>
    <table class="layui-hide" id="introTable" lay-filter="tableFilter"></table>
</div>
<script type="text/javascript" src="/plugins/layui/layui.js"></script>
<script>
    layui.use(['jquery','table','laydate','layer','form','util','layedit'],function(){
        var $=layui.jquery,table=layui.table,laydate = layui.laydate,
            layer = layui.layer,form = layui.form,util=layui.util,layedit=layui.layedit;

        table.render({
            elem:"#introTable",
            url:"/manage/intro/selIntro",
            method:"post",
            cols:[[
                {field:'id', title: 'ID', sort: true,align:'center',},
                {field:'type', title: '类型',align:'center',templet:function (d) {
                    if(d.type=='1'){
                        return '<div class="layui-btn layui-bg-green layui-btn-xs">大盘</div>';
                    }else if(d.type=='2'){
                        return '<div class="layui-btn layui-bg-blue layui-btn-xs">权重</div>';
                    }
                }},
                {field:'content', title: '简介内容',align:'center'},
                {field:'createTime', title: '创建时间',sort: true,align:'center',
                    templet: function(d){
                        if(d.createTime!=null){
                            return util.toDateString(d.createTime, 'yyyy-MM-dd HH:mm:ss');
                        }else{
                            return "";
                        }
                    }
                },
                {field:'updateTime', title: '更新时间',sort: true,align:'center',
                    templet: function(d){
                        if(d.updateTime!=null){
                            return util.toDateString(d.updateTime, 'yyyy-MM-dd HH:mm:ss');
                        }else{
                            return "";
                        }
                    }
                },
                {field: 'tool', title:"操作",align:'left',align:'center',
                    templet:function(d){
                        if(d.type=='3' || d.type=='4'){
                            return '';
                        }else{
                            return '<a href="#" class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
                        }
                    }
                }
            ]],
            limits:[10,15,20,25,30],
            limit:10,
            page:true
        });

        //表格监听
        table.on('tool(tableFilter)', function(obj){
            var data = obj.data;
            if (obj.event == "edit") {
                location.href='/manage/intro/editIntro/'+data.id;
            }
        });
    });
</script>

</body>
</html>